﻿using AlibabaCloud.SDK.Dysmsapi20170525;
using AlibabaCloud.SDK.Dysmsapi20170525.Models;
using QJY.Data;
using System;
using System.Collections.Generic;
using System.Net;

namespace QJY.Common
{
    public class MsgHelp
    {


        public static  Client CreateClient(string accessKeyId, string accessKeySecret)
        {
            AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config
            {
                // 您的AccessKey ID
                AccessKeyId = accessKeyId,
                // 您的AccessKey Secret
                AccessKeySecret = accessKeySecret,
            };
            // 访问的域名
            config.Endpoint = "dysmsapi.aliyuncs.com";
            return new Client(config);
        }

        public static void SendMsg(string strPhone,string strYZM)
        {
            string accessKeyId = CommonHelp.GetConfig("AccessKeyID");
            string accessKeySecret = CommonHelp.GetConfig("AccessKeySecret");


            Client client = CreateClient(accessKeyId, accessKeySecret);
            SendSmsRequest sendSmsRequest = new SendSmsRequest();

            // 复制代码运行请自行打印 API 的返回值
            client.SendSms(sendSmsRequest);
        }


    }
}
